package com.onlyxiahui.common.web.util;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author: XiaHui
 * date: 2017-03-31 11:07:04
 */
public class OnlyResultUtil {
	
	static final Logger logger = LoggerFactory.getLogger(OnlyResultUtil.class);

	public static void result(HttpServletResponse response, String result) {
		PrintWriter writer = null;
		try {
			response.setContentType("text/javascript");
			response.setCharacterEncoding("UTF-8");
			writer = response.getWriter();
			writer.println(result);
			writer.flush();
		} catch (Exception e) {
			logger.error("", e);
		} finally {
			if (null != writer) {
				writer.close();
			}
		}
	}
}
